package com.qqtech.qquan.order.service;

import java.math.BigDecimal;
import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import com.qqtech.core.frame.model.Result;
import com.qqtech.core.frame.service.BaseService;
import com.qqtech.qquan.order.model.OrderBase;
import com.qqtech.qquan.order.model.OrderBaseQuery;
import com.qqtech.qquan.order.model.OrderBaseVo;

public interface OrderBaseService extends BaseService<OrderBase> {
	/**
	 * 获取SellerTotal金额总额
	 * @param query
	 * @return
	 */
	public BigDecimal getSumSellerTotal(OrderBaseQuery query);
	
	public OrderBaseVo getByOrderNo(java.lang.String orderNo);

	/**
	 * 更新卖家总额
	 * 
	 * @param query
	 * @return
	 */
	int updateSellerTotalById(OrderBaseQuery query);

	/**
	 * 检查支付状态，并返回需要支付的信息(支付金额、标题、内容以及个人应用货币额度(如还有多少可用于支付的圈币))
	 * 
	 * @param orderNo
	 *            订单号
	 * @param userId
	 *            当前支付人id
	 * @return
	 */
	Result checkForPay(String orderNo, Integer userId);

	/**
	 * 后台查询列表
	 * 
	 * @param query
	 * @param pageable
	 * @return
	 */
	public Page<OrderBaseVo> queryPageListAdmin(OrderBaseQuery query, Pageable pageable);

	/**
	 * 后台导出excel
	 * 
	 * @param query
	 * @param pageable
	 * @return
	 */
	List<OrderBaseVo> queryList4Excel(OrderBaseQuery query, Pageable pageable);

	/**
	 * 根据供应商(商城)或店铺(圈商)查询订单列表
	 * 
	 * @param query
	 * @param pageable
	 * @return
	 */
	public Page<OrderBaseVo> queryPageBySupplier(OrderBaseQuery query, Pageable pageable);

	/**
	 * 根据根据供应商(商城)或店铺(圈商)查询订单数量
	 * 
	 * @param query
	 * @return
	 */
	public int queryCountBySupplier(OrderBaseQuery query);

	/**
	 * 配送人员查询订单列表
	 * 
	 * @param query
	 * @param pageable
	 * @return
	 */
	public Page<OrderBaseVo> queryPageBySendDeliveryUser(OrderBaseQuery query, Pageable pageable);

	/**
	 * 配送人员查询订单数量
	 * 
	 * @param query
	 * @return
	 */
	public int queryCountBySendDeliveryUser(OrderBaseQuery query);

	/**
	 * 根据圈商店铺Id查询订单总金额
	 * 
	 * @param shopId
	 * @return
	 */
	BigDecimal queryTotalPriceByShop(Integer shopId);

	/**
	 * admin管理后台查询订单汇总金额
	 * @param query
	 * @return
	 */
	BigDecimal getSumTotal4Admin(OrderBaseQuery query);

	List<OrderBaseVo> queryOrderCountByUserIds(List<Integer> userIds);
}